package com.ssmdemo.pojo;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;

@TableName(value = "t_menu")
public class MenuEntity {

    @TableId(type = IdType.AUTO)
    private Integer id;

    @TableField(value = "menu_name")
    private String menuName;

    @TableField(value = "menu_url")
    private String menuUrl;

    @TableField(value = "menu_type")
    private Integer menuType;

    @TableField(exist = false)
    private MenuEntity parentMenuEntity;

    @TableField(value = "permissions_code")
    private String permissionsCode;

    @TableField(value = "menu_describe")
    private String menuDescribe;

    @TableField(exist = false)
    private Integer subId;

    @TableField(value = "parent_menu_id")
    private Integer parentId;

    @TableField(exist = false)
    private String menuTypeString;

    public String getMenuTypeString() {
        return menuTypeString;
    }

    public void setMenuTypeString(Integer menuType) {

    }

    public Integer getParentId() {
        return parentId;
    }

    public void setParentId(Integer parentId) {
        this.parentId = parentId;
    }

    public MenuEntity getParentMenuEntity() {
        return parentMenuEntity;
    }

    public void setParentMenuEntity(MenuEntity parentMenuEntity) {
        this.parentMenuEntity = parentMenuEntity;
    }

    public String getMenuDescribe() {
        return menuDescribe;
    }

    public void setMenuDescribe(String menuDescribe) {
        this.menuDescribe = menuDescribe;
    }

    public Integer getSubId() {
        return subId;
    }

    public void setSubId(Integer subId) {
        this.subId = subId;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getMenuName() {
        return menuName;
    }

    public void setMenuName(String menuName) {
        this.menuName = menuName;
    }

    public String getMenuUrl() {
        return menuUrl;
    }

    public void setMenuUrl(String menuUrl) {
        this.menuUrl = menuUrl;
    }

    public Integer getMenuType() {
        return menuType;
    }

    public void setMenuType(Integer menuType) {
        if (menuType==1){
            this.menuTypeString = "菜单";
        }else {
            if (menuType==2){
                this.menuTypeString = "目录";
            }else {
                if (menuType==3){
                    this.menuTypeString = "按键";
                }
            }
        }
    }

    public String getPermissionsCode() {
        return permissionsCode;
    }

    public void setPermissionsCode(String permissionsCode) {
        this.permissionsCode = permissionsCode;
    }

    public String getPermissionsDescribe() {
        return menuDescribe;
    }

    public void setPermissionsDescribe(String menuDescribe) {
        this.menuDescribe = menuDescribe;
    }

    @Override
    public String toString() {
        return "MenuEntity{" +
                "id=" + id +
                ", menuName='" + menuName + '\'' +
                ", menuUrl='" + menuUrl + '\'' +
                ", menuType=" + menuType +
                ", menuEntity=" + parentMenuEntity +
                ", PermissionsCode='" + permissionsCode + '\'' +
                ", PermissionsDescribe='" + menuDescribe + '\'' +
                '}';
    }
}
